//
//  HotViewcontroller.m
//  YSBEmployer
//
//  Created by developer on 2021/12/05.
//  Copyright © 2021 ysb. All rights reserved.
//

#import "YSBMessageHeaderView.h"


@implementation YSBMessageHeaderView

- (void)prepareSubViewsWithItemArray {
    

}

- (void)reloadHeaderDataWithItemArray:(NSArray *)itemArray {
    
    self.itemArray = itemArray;
        
    CGFloat msgHeaderHeight = 110;

    CGFloat msgHeaderWidth = self.frame.size.width - 30;
    
    CGRect tempFrame = CGRectMake(15, 0, msgHeaderWidth, msgHeaderHeight);
    self.collectionView.frame = tempFrame;
            
    [self.collectionView reloadData];
}


- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section {

    return self.itemArray.count;
    
}


- (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath {
    
    CGFloat msgHeaderWidth = self.frame.size.width - 30;
    
    CGFloat dWidth = ((msgHeaderWidth) / 4) - 6;
    CGFloat dHeight = 85;
    return CGSizeMake(dWidth, dHeight);
}

- (UIEdgeInsets)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout insetForSectionAtIndex:(NSInteger)section{
    // top left down right
    return UIEdgeInsetsMake(15, 5, 0, 5);
}


@end
